package com.leyou.common.utils;

/**
 * @author xhh
 * @describe 描述
 * @date 2022/5/23
 */
public class StringUtils {
    /**
     * 数字转换编码数字
     * @author: xhh
     * @date: 2022/5/23
     * @description: 列入传入 15,5 返回 00015
     * @return:
     * @params:
     */
    public static StringBuffer codedNumber(Integer num,Integer code){
        Integer n;
        n=num;
        StringBuffer coded = new StringBuffer();
        int wei = 1;
        while (num / 10 != 0) {
            num=num/10;
            wei++;
        }
        if (wei > code) {
            code = wei;
        }
        for (int i = 1; i <= code - wei; i++) {
            coded.append("0");
        }
        coded.append(""+n);

        return coded;
    }
}
